<?php

namespace app\storage\controller;


use app\storage\model\BomDetailModel;
use app\storage\model\BomModel;
use cmf\controller\AdminBaseController;

class OtherController extends AdminBaseController
{
    public function kitting(){
        return $this->fetch('kitting');
    }

    public function delete(){
        $uuid = input('uuid');
        $bomModel = new BomModel();
        $hidden = $bomModel->where('uuid',$uuid)->value('hidden');
        switch ($hidden){
            case 1://原先隐藏的，只需删除即可
                $bomModel->where('uuid',$uuid)->delete();
                $bomDetailModel = new BomDetailModel();
                $bomDetailModel->where('bom_uuid',$uuid)->delete();
                break;
            case 2://两边都显示的，改为只在单据查询处显示即可
                $bomModel->where('uuid',$uuid)->save(['hidden'=>0]);
                break;
            default:
                break;
        }
        return json(ret_template(true,'删除成功'));
    }
}